package leaf.science.ui.rightmenu
{
	import caurina.transitions.Tweener;
	
	import flash.events.MouseEvent;
	
	public class RightMenuItem extends LeafSci_rightMenu_item_skin
	{
		public var index:uint;
		public var id:uint;
		
		private var _radius:Number;
		private var _upTextColor:uint;
		private var _overTextColor:uint;
		
		public function RightMenuItem(id:uint, text:String)
		{
			super();
			this.id = id;
			_txt.text = text;
			bullet_mc.alpha = 0;
			buttonMode = true;
			mouseChildren = false;
			
			addEventListener(MouseEvent.MOUSE_OVER, onRollOver);
			addEventListener(MouseEvent.MOUSE_OUT, onRollOut);
			
			_upTextColor = _txt.textColor;
			_overTextColor = 0x817f80;
		}
		
		public function set text (value:String):void
		{
			_txt.text = value;
		}
		
		public function get text ():String
		{
			return _txt.text;
		}
		
		public function radius (value:Number):void
		{
			_radius = value;
			_txt.x = value;
			bullet_mc.x = value;
			bg_mc.x = value;
		}
		
		public function onRollOver (ect:MouseEvent = null):void
		{
			_txt.textColor = _overTextColor;
			Tweener.addTween(_txt, {x:_radius + 13, time:0.3});
			Tweener.addTween(bullet_mc, {alpha:1, time:0.4});
		}
		
		public function onRollOut (ect:MouseEvent = null):void
		{
			_txt.textColor = _upTextColor;
			Tweener.addTween(_txt, {x:_radius, time:0.4});
			Tweener.addTween(bullet_mc, {alpha:0, time:0.2});
		}
		
	}
}